<group>
<ul class='breadcrumb'><li><a href='%pathto:mdoc;'>Index</a></li><li><a href='%pathto:kmeans.vl_ikmeanspush;'>Prev</a></li><li><a href='%pathto:misc.vl_alldist2;'>Next</a></li></ul><div class="documentation"><p>
[C, A] = <a href="%pathto:kmeans.vl_kmeans;">VL_KMEANS</a>(X, NUMCENTERS) clusters the columns of the
matrix X in NUMCENTERS centers C using k-means. X may be either
SINGLE or DOUBLE. C has the same number of rows of X and NUMCENTER
columns, with one column per center. A is a UINT32 row vector
specifying the assignments of the data X to the NUMCENTER
centers.
</p><p>
[C, A, ENERGY] = <a href="%pathto:kmeans.vl_kmeans;">VL_KMEANS</a>(...) returns the energy of the solution
(or an upper bound for the ELKAN algorithm) as well.
</p><p>
KMEANS() supports different initialization and optimization
methods and different clustering distances. Specifically, the
following options are supported:
</p><dl><dt>
Verbose
</dt><dd><p>
Increase the verbosity level (may be specified multiple times).
</p></dd><dt>
Distance
<span class="defaults">[L2]</span></dt><dd><p>
Use either L1 or L2 distance.
</p></dd><dt>
Initialization
</dt><dd><p>
Use either random data points (RANDSEL) or k-means++ (PLUSPLUS)
to initialize the centers.
</p></dd><dt>
Algorithm
<span class="defaults">[LLOYD]</span></dt><dd><p>
Use either the standard LLOYD or the accelerated
ELKAN algorithm for optimization.
</p></dd><dt>
NumRepetitions
<span class="defaults">[1]</span></dt><dd><p>
Number of time to restart k-means. The solution with minimal
energy is returned.
</p></dd><dt>
Example
</dt><dd><p>
<a href="%pathto:kmeans.vl_kmeans;">VL_KMEANS</a>(X, 10, 'verbose', 'distance', 'l1', 'algorithm',
'elkan') clusters the data point X using 10 centers, l1
distance, and the Elkan's algorithm.
</p></dd></dl><p>
See also: <a href="%pathto:vl_help;">VL_HELP</a>().
</p></div></group>
